import { createBrowserRouter } from 'react-router-dom'
import App from '../App'
import Home from '../pages/Home'
import List from '../pages/List'
import Ticket from '../pages/Ticket'
import Order from '../pages/Order'
let router = createBrowserRouter([
    {
        path: '/',
        element: <App></App>,
        children: [
            {
                index: true,
                element: <Home></Home>
            },
            {
                path: 'Home',
                element: <Home></Home>
            }
        ]
    },
    {
        path: 'list',
        // element:<List></List>
        lazy: async () => {
            const { default: List, loader } = await import('../pages/List')
            return {
                element: <List></List>,
                loader
            }
        }
    },
    {
        path: 'ticket/:id',
        // element: <Ticket></Ticket>
        lazy: async () => {
            const { default: Ticket, loader } = await import('../pages/Ticket')
            return {
                element: <Ticket></Ticket>,
                loader
            }
        }
    },
    {
        path: 'order',
        element: <Order></Order>
    }

])
export default router